<%--
  Created by IntelliJ IDEA.
  User: 86191
  Date: 2022/11/29
  Time: 20:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>增加学生</title>
    <style>
        #box1 {
            height: 650px;
            width: 400px;
            margin: 60px auto;
            border: 1px solid red;
            border-radius: 20px;
        }
        div {
            margin: 14px auto;
            border-bottom: 1px solid red;
            width: 300px;
            height: 50px;
        }
        #son {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #u_name {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }

        #u_pwd {
            height: 50px;
            width: 190px;
            border: 0;
            /*去掉边框*/
            outline: none;
        }

        #u_sex {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #Java {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #Python {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #sjk {
            height: 50px;
            width: 220px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #jsj {
            height: 50px;
            width: 180px;
            /*去掉边框*/
            outline: none;
            border: 0;
        }
        #box5 {
            width: 300px;
            height: 30px;
            font-size: 20px;
            margin-top: 20px;
            margin-left: 50px;
            color: red;
        }
        #but {
            height: 40px;
            width: 300px;
            margin-left: 50px;
            text-align: center;
            line-height: 40px;
            background-color: red;
        }
    </style>
</head>
<body>
<div id="box1">
    <form action="insert" method="post">
        <div>学号：<input type="text" name="son" id="son"></div>
        <div>姓名：<input type="text" name="name" value="学生姓名" id="u_name"></div>
        <div>密码：<input type="password" name="pwd" value="" id="u_pwd"> <span id="looks">显示</span></div>
        <div>性别：<input type="text" name="sex" value="1为男 0为女" id="u_sex"></div>
        <div>Java：<input type="text" name="java" id="Java" value="分数"></div>
        <div>Python：<input type="text" name="Python" id="Python"></div>
        <div>数据库：<input type="text" name="sjk" id="sjk"></div>
        <div>计算机网络：<input type="text" name="jsj" id="jsj"></div>


        <button id="but">下一步</button>
    </form>
</div>

<script>
    let look = document.getElementById("looks");
    let u_pwd = document.getElementById("u_pwd");
    let u_name = document.getElementById("u_name");
    let ts = document.getElementById("box5");
    let xyb = document.getElementById("but");
    let sex=document.getElementById("u_sex");

    let fang = 1;
    look.onclick = function () {
        if (fang == 1) {
            u_pwd.type = "text";
            look.innerHTML = "不显示";
            fang = 0;
        } else {
            u_pwd.type = "password";
            look.innerHTML = "显示";
            fang = 1;
        }
    }

    function isEmpty(str) {
        if (str == null || str.trim() == "") {
            return true;
        }
        return false;
    }
    xyb.onclick = function () {
        if (isEmpty(u_name.value)) {
            ts.innerHTML = "账户不能为空";
            return false;
        }
        if (isEmpty(u_pwd.value)) {
            ts.innerHTML = "密码不能为空";
            return false;
        }
        if (isEmpty(u_pwds.value)) {
            ts.innerHTML = "密码不能为空";
            return false;
        }
    }
</script>
</body>
</html>
